<!--
*Author：富行天下团队
 *
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/mall/Mall_good.js此处编写
 -->



<template>
  <div style="background: white; margin-top: 15px">
    <el-tabs type="border-card" style="height: 400px">
      <el-tab-pane>
        <span slot="label"><i class="el-icon-date"></i> 商品明细</span>
        <vol-table
          ref="tableList"
          :loadKey="true"
          :columns="columns"
          :pagination-hide="false"
          :height="300"
          :defaultLoadPage="false"
          @loadBefore="loadBefore"
          :endEditAfter="endEditAfter"
          url="api/Products/getDetailPage"
          :row-index="true"
          :columnIndex="true"
          :index="true"
          :click-edit="true"
        ></vol-table>
      </el-tab-pane>
      <el-tab-pane >
        <span slot="label"><i class="el-icon-date"></i> 套票明细</span>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
    import VolTable from "@/components/basic/VolTable.vue";
    var vueParam = {
        components: {
            VolTable
        },
        methods: {
      
        loadBefore(params, callback) {
          
        //设置查询 条件
        // var _row;
        // //获取主表选中的行
        // this.$emit("parentCall", ($vue) => {
        //     var rows = $vue.getSelectRows();
        //     if (rows.length) {
        //     _row = rows[0];
        //     }
        // });
        // if (!_row){
        //     //取消选中，清空明细
        //     return this.$refs.tableList.rowData.length=0;
        //     //  return this.$Message.error("请选中主表行数据");
        // }
        
        

        // //设置查询条件，用主表id加载明细表数据(如果是自己定义的接口，这里条件自己处理)
        // params.value = _row.id;
        // //设置排序字段(如果是自己定义的接口，排序字段不一定填写)
        // if (!params.sort) {
        //     params.sort = "CreateDate";
        // }
        
        return callback(true);
        },
        endEditAfter(row) {
        //结束编辑时，可以直接调用后台的代码进行保存
        //console.log(row);
        return true;
        },
        },
        data() {
            return {
                tableData: [],
                // extend: extend,
                // editFormFields: {"name":"","name2":"","productID":"","originalPrice":"","preferentialPrice":"","attributes":"","modifier":"","modifyDate":"","modifyID":"","createDate":"","createID":"","creator":""},
                // editFormOptions: [
                //                 [{"title":"商品名称","required":true,"field":"name","type":"text"},
                //                {"title":"简称","required":true,"field":"name2","type":"text"}],
                //                [{"title":"产品ID","required":true,"field":"productID","type":"text"},
                //                {"title":"原价","required":true,"field":"originalPrice","type":"text"}],
                //                [{"title":"优惠价","required":true,"field":"preferentialPrice","type":"text",},
                //                {"title":"属性","required":true,"field":"attributes","type":"select","dataKey": "unit",}]],
                //             //  [{"title":"修改人","required":true,"field":"modifier","type":"text",colSize: 12,}],
                //              //  [{"title":"修改人时间","required":true,"field":"modifyDate ","type":"text",colSize: 12,}],
                //              //   [{"title":"修改人ID","required":true,"field":"modifyID","type":"switch",colSize: 12}],
                //              //   [{"title":"创建时间","required":true,"field":"createDate","type":"date","range": "true",colSize: 12,}],
                //               // [{"title":"创建人ID","required":true,"field":"createID","type":"img"}],
                //              //  [{"title":"创建人ID","required":true,"field":"createID","type":"text",}],
                //               // [{"title":"创建人","required":true,"field":"creator","type":"text",}]],
                // searchFormFields: {},
                // searchFormOptions: [],
                columns: [{field:'id',title:'主键',type:'string',width:90,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'name',title:'名称',type:'string',width:150,align:'left',sortable:true},
                       {field:'name2',title:'简称',type:'string',width:150,align:'left'},
                      // {field:'offlineCode',title:'线下编码',"required":true,type:'string',width:150,align:'left'},
                       {field:'offlineCode',title:'线下编码',type:'string',require:true,width:150,edit:{type:'text'},align:'left'},
                      //  {field:'productID',title:'产品ID',type:'string',width:90,align:'left'},
                       {field:'originalPrice',title:'原价',type:'decimal',width:100,align:'left'},
                       {field:'preferentialPrice',title:'优惠价',type:'decimal',width:100,align:'left'},
                       {field:'attributes',title:'属性',type:'string',width:100,align:'left'},
                        {field:'modifier',title:'修改人',type:'string',width:100,align:'left'},
                       {field:'modifyDate',title:'修改时间',type:'datetime',width:135,align:'left',sortable:true},
                      //  {field:'modifyID',title:'修改人ID',type:'int',width:90,hidden:true,align:'left'},
                       {field:'createDate',title:'创建时间',type:'datetime',width:135,align:'left',sortable:true},
                      //  {field:'createID',title:'创建人ID',type:'int',width:90,hidden:true,align:'left'},
                       {field:'creator',title:'创建人',type:'string',width:100,align:'left'}],
                
            };
        }
    };
    export default vueParam;
</script>
